﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Xml.Linq;
using System.Diagnostics;

namespace MLY
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            Log.WriteInfo("--- Application Started ---");
        }


        protected void Application_Error(object sender, EventArgs e)
        {
            Log.OnApplication_Error(sender, Server);
        }

        protected void Session_Start(object sender, EventArgs e)
        {
            Session.Timeout = 60;             
            if (Utils.IsDebug)
            {
                /*Session["UserId"] = 1;
                Session["FullName"] = "Test IT";
                Session["OrganizationId"] = 1;
                Session["OrganizationName"] = "Organization Test";
                Session["Culture"] = "en";
                Session["RoleId"] = 60;
                Session["DefaultLinesinGrid"] = 10;*/
                //
                //Session["UserId"] = 3;
                //Session["FullName"] = "yoav feuerstein";
                //Session["OrganizationId"] = 25;
                //Session["Culture"] = "en";
                //Session["RoleId"] = 60;
            }

            // TODO: handle the dict cache issue
            //LoadDict();
            Session["DemoStage"] = "none";
            Session["DemoSubStage"] = "0";
        }

        //private void LoadDict()
        //{
        //  Dict.lqDictDataContext db = new MLY.Dict.lqDictDataContext();
        //  Utils.dicts = db.Dicts.ToList();
        //}

        protected void Session_End(object sender, EventArgs e)
        {
            Session.Clear();
        }
    }
}